<?php if(!defined('IN_FIRADIO')) {header('HTTP/1.1 403 Forbidden');exit('<h1>Access Denied</h1>');}?>
<?php $GLOBALS['script'][] = function() {?><script>
vue.data.apidata = {};
vue.methods.submit_list = function () {
    const form = {};
    vue.methods.ApiPost('/api/nthost/list.php', form).then(function (res) {
        vue.data.apidata = res.data;
    }, function (res) {
        console.log('reject:', res);
    }).catch(function (reason) {
        console.log('catch:', reason);
    }).then(function () {
        setTimeout(vue.methods.submit_list, 2000);
    });
};
vue.methods.timeout = function (times) {
    const timeout = Math.round(this.apidata.time - times);
    return timeout;
};
vue.mounted = function () {
    const that = this;
    vue.methods.submit_list();
};

</script><?php }?>
<table
id="example1" class="table table-bordered table-hover table-striped dataTable" role="grid" aria-describedby="example1_info">
    <thead>
        <tr role="row">
            <th>序号</th>
            <th>地域</th>
            <th>机号</th>
            <th>远程地址</th>
            <th>计费间隔</th>
            <th>活动间隔</th>
        </tr>
    </thead>
    <tbody>
        <tr role="row" class="odd" v-for="(row,i) in apidata.rows">
            <td>{{i+1}}</td>
            <td>{{row.region_title}}</td>
            <td>{{row.name}}</td>
            <td>{{row.rdpaddr}}:{{row.rdpport}}</td>
            <td>
                <font color="#dd0000" v-if="timeout(row.reported)>=1800">{{timeout(row.reported)}}</font>
                <font color="#ff8800" v-else-if="timeout(row.reported)>=600">{{timeout(row.reported)}}</font>
                <font color="#00aa00" v-else>{{timeout(row.reported)}}</font>
            </td>
            <td>
                <font color="#dd0000" v-if="timeout(row.operated)>=10">{{timeout(row.operated)}}</font>
                <font color="#00aa00" v-else>{{timeout(row.operated)}}</font>
            </td>
        </tr>
    </tbody>
</table>
